1. The Field of the Invention
The present invention relates to the fields of distributed computing systems, client-server computing and object-oriented programming. More specifically, the present invention includes a method and apparatus for managing connections among process that implement objects in a distributed object environment.
2. The Relevant Art
Object oriented programming methodologies have received increasing attention over the past several years in response to the increasing tendency for software developed using traditional programming methods to be delivered late and over budget (Taylor 1990; Gibbs 1994). This problem stems from the fact that software written using traditional programming techniques that emphasize procedural models and xe2x80x9clinearxe2x80x9d code is extremely difficult to design and maintain for many problems. Generally, large programs created using traditional methods are xe2x80x9cbrittlexe2x80x9d, that is, even small changes can effect all elements of the programming code. Thus, minor changes made to the software in response to user demands can require major redesign and rewriting of the entire program.
Object oriented programming strategies tend to avoid these problems because object methodologies focus on manipulating data rather than procedures; thus, providing the programmer with a more intuitive approach to modeling real world problems. In addition objects encapsulate related data and procedures so as to hide that information from the remainder of the program by allowing access to the data and procedures only through the object""s interface. Hence changes to the data and/or procedures of the object are relatively isolated from the remainder of the program. This provides code that is more easily maintained as compared to code written using traditional methods, as changes to an object""s code do not affect the code in the other objects. In addition, the inherent modular nature of objects allows individual objects to be reused in different programs. Thus, programmers can develop libraries of xe2x80x9ctried and truexe2x80x9d objects that can be used over and over again in different applications. This increases software reliability while decreasing development time, as reliable programming code may be used repeatedly.
However, the full promise of object oriented methodologies, especially the advantages afforded by their modularity, have yet to be achieved. In particular, it would be highly desirable to allow programmers and other users access to objects in a transparent fashion so that objects created in different programming languages and objects residing on different computing platforms that are networked together are accessible to the user without extensive modification of the user""s programming code.
Attempts to provide such facilities have been made using object oriented distributed systems that are based upon a client-server model, in which object-servers, or objects, provide interfaces to clients that make requests to the objects. Typically, in such systems the objects consist of data and associated methods and are contained within a server process. Clients obtain access to the functionalities of objects by executing calls on them, which calls are mediated by the distributed system. When the object within the server process receives a call it executes the appropriate method and transmits the result back to the client. The client and server process communicate through an Object Request Broker (ORB) which is used to locate the various distributed objects and establish communications therebetween (OMG 1990).
The object paradigm in distributed systems is a useful technique as it separates the object""s interface from its implementation; thus, allowing software designers to take advantage of the functionalities of various objects available to them without having to worry about the details of the object""s implementation. The programmer need only be aware of the object""s interface. In addition, object oriented distributed systems allow for multiple implementations of a single interface, which interface may reside on different computing platforms that have been connected through a network. Thus, a programmer working on one machine of a network may make a call to an object about which the programmer has no detailed knowledge with the confidence that at the appropriate time the remote object will be accessed and return its data so that the programmer""s code will function properly. Such a system thus maximizes the inherent advantages of object oriented methodologies by taking full advantage of their modularity and encapsulation.
Unfortunately, the methods governing connections between clients and servers in present distributed object environments suffer from several serious drawbacks. Generally, present distributed object systems define clients and servers as unequal partners for the purposes of controlling connections by using what is known as an xe2x80x9casymmetricxe2x80x9d protocol (Levy 1991). In an asymmetric protocol, only the client can break a connection in a client-server communication (the xe2x80x9csmart client, dumb serverxe2x80x9d model). Yet often it is the server that needs to limit the number of connections made to it so as to avoid becoming overloaded with client requests. Nevertheless, in asymmetric systems the server must wait until a client breaks a connection before resources can be freed in the server.
In addition, present systems require clients to maintain an exclusive connection for the duration of the call to the server. This requirement forces other clients to either (1) wait for free connections with the server, thus degrading the operation of the system as bottlenecks develop while clients wait for replies from the connected servers; or (2) establish new connections to the same server. Thus, a client must wait while the server completes execution of a remote operation even though other clients could take advantage of the temporarily idle connection. Both conditions prevent efficient multiplexing of connections and therefore degrade system performance and waste system resources, such as memory and processor cycles. -Present systems also manage resources inefficiently by requiring separate connections for client-to-server and server-to-client invocations. Thus, two client-server transactions can tie-up two communications channels where the use of a single channel for both transactions may suffice. Furthermore, present distributed object systems are not designed to handle multithreaded processing and therefore fail to take advantage of the opportunities of multithreaded technologies.
Finally, in present systems termination of connections before the completion of a transaction between the server and client (i.e., a request followed by a reply) generate an error state regardless of whether the termination was performed by the system or is the result of a true system error. Thus, even routine cases where a connection is shut down in a controlled manner are treated as an error condition, as if the other end of the connection failed. Such a method leaves the status of the transaction between the client and server completely ambiguous and promotes inefficiency, or worse causes a programming or system failure as the abandoned side of the connection either has to resend a request that has already been fulfilled or assume the request has been met when in fact the request has gone ignored.
The present invention includes a method and apparatus for forming and terminating connections between objects in a distributed object environment. Using the method and apparatus of the invention, connections between objects can be created and terminated in a reliable and efficient manner. In one especially important aspect, the present invention provides a method for deliberately terminating connections without loss of information. This method allows an object to determine how to re-establish its connection to the object it had been communicating with. This feature increases system reliability and robustness by reducing the chance of system failure arising from the use of false error messages.
In one aspect, the present invention includes a method for terminating connections between a server process and a client which includes the steps of sending reliably a connection end message from the server process to the client across the connection. The connection end message is effective to indicate to the client that the server process will no longer respond to request messages sent by the client to the server. The method further includes the step of closing the connection. In a preferred embodiment, the connection is a multiplexed connection between the server and client which allows the server and client to pass messages between each other using the same physical connection. In another preferred embodiment, a shut down code is sent along with the connection end message. The shut down code is effective to indicate to the client how to reconnect to a server process that includes the object which the client is invoking. Preferably the connection is terminated in response to a determination that the server is in an overloaded or oversubscribed state.
In another aspect, the present invention includes a method for establishing a connection between a client and an object in a multithreaded environment. The method of the invention includes searching for an active connection record in a table of active connection records, and examining the host name and the server port ID of a least one active connection record in the table of active connection records. If an active connection record is found having the desired host name and server port ID, a determination is made as to whether the active connection is in an established state and whether the write lock of the active connection record is held. The method concludes with the step of acquiring the active connection record. In a preferred embodiment, the method just described further includes the step of acquiring a table lock on the table of active connection records and releasing a table lock after the active connection has been acquired, and the step of waiting for the active connection to reach an established state and the write lock to be released.
In another preferred embodiment, the above described method for establishing a connection further includes searching for a free connection record in response to a determination that no active connection record is available for connecting to the server. If a free connection record is available, the free connection record is initialized and moved to the list of active connection records to create thereby a new active connection, which is marked as opening. The write lock of the new active connection and the communication endpoint are acquired after which a connection between the client and server is established. Upon establishing the connection, the active connection record is marked as established. In a preferred embodiment, the method further includes the step of signaling waiting threads that a new connection is now established, and releasing temporarily the table lock on the table of active connection records during the period in which the connection is being established.
In still another aspect, the present invention includes a method for creating a connection between a client and a server process by closing an existing active connection between a client and an object. The method of the invention includes determining whether an existing active connection between the object and client is an established state and, if so, whether any requests that have been issued on the connection have not been responded to, or if any requests already received on the connection have not been responded to. In a preferred embodiment, if more than one active connection meets these criteria, the oldest unused active connection is closed.
In a separate aspect of the present invention, a computer process for use on a computer system a distributed object system is disclosed. The computer process has an active connection table which includes a table lock operable to inhibit access to the active connection table such that only a single entity having possession of the table lock may access the active connection table and a connection record for use in storing information regarding a connection between the computer process and a host computer system. In a related aspect of the present invention the connection record includes a host name field, a port identification field, a connection handle field, a connection state, a connection write lock, a requests outstanding field, and a replies outstanding field. The host name field is for use in identifying the host computer with which the computer process has the connection. The port identification is for use in specifying a port number for the host computer. The connection handle field contains a value which uniquely identifies the connection. The connection state indicates the state of the connection and may be either free, opening, established, or closing. The connection write lock indicates whether the connection is available for writing and the connection read lock indicates whether the connection is available for reading. The requests outstanding field serves to indicate the number of requests made by a client across the connection which have not been responded to. The replies outstanding field serves to indicate the number of replies a server has not yet provided across the connection. Both the server and the client are associated with the computer process.
In yet another aspect the present invention includes a distributed object system which system includes a system for terminating the connection between a server process and a client. The system includes a messaging device for sending a connection end message from the server process to the client, which connection end message is effective to indicate to the client that the server process will no longer respond to request messages sent from the client. The system further includes a mechanism for closing the connection. Preferably the connection is a multiplexed connection and includes a mechanism for maintaining more than one connection between the server process and other client objects. Preferably the connection is terminated in response to a determination that the server is in an overloaded or oversubscribed state.
In still another aspect the present invention includes an apparatus for establishing a connection between a client and the server process in a multithreaded environment. The apparatus includes a first search mechanism for searching for an active connection record in a table of connection records and an examination device for examining the host name and server port ID of at least one active connection record in the table. The system further includes a first state evaluator for determining whether an active connection record having an appropriate host name and server port ID is in an established state and that the write lock state of the active connection record is not held by an active thread.
The system in another preferred embodiment further includes a second search mechanism for searching for a free connection record if no active connection record is available and an initializer for initializing a free connection record and moving the connection record to the active connection record list to thereby create a new active connection if a free connection record is available. The system further includes a first marking device for marking the new active connection as opening and an acquisition device for acquiring the write lock of the active connection. The system also includes a communications device for acquiring a communication end point and establishing a connection between the client and server in addition to a second marking device for marking the active connection record as established.
In still another aspect the system includes a closing device for closing an active connection including a first evaluator for determining if an active connection is in an established state, and second and third evaluators for determining if an established connection is idle, i.e., that any request that has been issued on the active connection has not received a response and any request has been received on the active connection that has not been responded to.
Preferably the system further includes another messaging device for sending a connection end message from the server process to the client on the connection, the connection end message being effective to indicate to the client that the server process will no longer respond to request messages from the client and means for closing the connection.
These and other aspects and advantages of the present invention will be made more clear by reference to the detailed description below and the accompanying figures.